<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title></title>
</head>

<body>
  <script>
    //forEach() 方法用于调用数组的每个元素，并将元素传递给回调函数。
    let arr = [
      { name: '小明', age: '12' },
      { name: '小王', age: '18' },
    ]
    arr.forEach((item) => {
      if (item.name === '小明') { //存在就进来
        console.log('存在', item)
      }
    })

    //every检测数组中的每一项
    var num = [10, 1245, 56, 89, 21, 56]
    function str(s, index) {
      return s == 15
    }
    console.log(num.every(str))
    //some() 方法用于检测数组中的元素是否满足指定条件
    var nus = ['s', 1245, 56, 89, 21, 56]
    function ste(age, index) {
      return age === 's'
    }
    console.log(nus.some(ste))
  </script>
</body>

</html>